
package com.cskaoyan.config.exception;

import com.cskaoyan.bean.BaseRespVo;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author LiangRuiJiang
 * @since 2022/06/08  15:40
 */
@RestControllerAdvice
public class LoginAuthenExceptionControllerAdvice {

    @ExceptionHandler(LoginAuthenException.class)
    public BaseRespVo loginAuthenException(LoginAuthenException e){
        return BaseRespVo.shouldLogin();
    }

    @ExceptionHandler(UnauthorizedException.class)
    public BaseRespVo unauthorizedException(UnauthorizedException e){
        return BaseRespVo.unauthorized();
    }
}

